//
// Decompiled by Jadx - 564ms
//
package fp;

import android.database.Cursor;
import android.text.TextUtils;
import com.google.gson.Gson;
import de.robv.android.xposed.XposedHelpers;
import fm.i;
import fn.b;
import fn.j;
import fn.y;
import fq.r;
import gc.ap;
import gc.at;
import gc.bx;
import gc.cb;
import gc.cf;
import gc.z;
import gd.c;
import ge.d;
import gf.ab;
import gf.f;
import gf.i;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import me.plusne.common.Json.JsonHookStatic;
import me.plusne.common.Json.TB.JsonTbSign;
import me.plusne.common.Json.TB.TBInSignJson;
import p.e;
import r.f;
import r.h;

public final class aa implements Runnable {
    public final int a;

    @Override
    public final void run() {
        boolean z;
        JsonTbSign jsonTbSign;
        Class ak;
        Object[] objArr;
        TBInSignJson tBInSignJson;
        boolean z2 = false;
        int i = 1;
        switch (this.a) {
            case 0:
                JsonHookStatic jsonHookStatic = y.by;
                Object aa = j.aa(jsonHookStatic.getHook_ViewPager(), "getCurrentItem");
                if (!jsonHookStatic.isComment() && !jsonHookStatic.isOpenMenu() && !jsonHookStatic.isShortcutMenuIsShow() && jsonHookStatic.isPlay()) {
                    j.ab(jsonHookStatic.getHook_ViewPager(), "LIZ", new Object[]{Integer.valueOf(((Integer) aa).intValue() + 1), Boolean.TRUE});
                    return;
                }
                return;
            case 1:
                aa aaVar = r.cp;
                JsonHookStatic jsonHookStatic2 = y.by;
                Object aa2 = j.aa(jsonHookStatic2.getHook_ViewPager(), "getCurrentItem");
                if (!jsonHookStatic2.isComment() && !jsonHookStatic2.isOpenMenu() && !jsonHookStatic2.isShortcutMenuIsShow() && jsonHookStatic2.isPlay()) {
                    j.ab(jsonHookStatic2.getHook_ViewPager(), "LIZ", new Object[]{Integer.valueOf(((Integer) aa2).intValue() + 1), Boolean.TRUE});
                    return;
                }
                return;
            case 2:
                List cq = cb.cq(ap.dj);
                ap.dj = cq;
                if (cq != null) {
                    for (Object obj : cq) {
                        if (y.ch("ReqRecommendedAuto", false)) {
                            ap.cv++;
                            at.cr(obj);
                            int cd = y.cd(1000, "autoNumStop");
                            if (ap.cw > cd || ap.cy > cd || ap.da > cd || ap.dc > cd || ap.dd > cd || ap.df > cd || ap.dh > cd) {
                                y.co(Boolean.FALSE, "ReqRecommendedAuto");
                                f i2 = f.i();
                                i2.n();
                                i2.l("(自动瞬间操作)已达到预设值,停止运行");
                                return;
                            }
                        } else {
                            return;
                        }
                    }
                    return;
                }
                return;
            case 3:
                int i3 = bx.b.a;
                j.aa(y.by.getSoul().getBaseProviderMultiAdapter(), "notifyDataSetChanged");
                return;
            case 4:
                z.ec(0L, 1, cf.cp);
                return;
            case 5:
                z.ec(0L, 2, cf.cp);
                return;
            case 6:
                z.ec(0L, 3, cf.cp);
                return;
            case 7:
                AtomicBoolean atomicBoolean = c.cp;
                if (!atomicBoolean.compareAndSet(false, true)) {
                    j.bi(new Object[]{"签到任务正在进行中，等待下次执行..."});
                    return;
                }
                try {
                    Object bk = j.bk(j.ak("com.baidu.tbadk.core.util.NetWork"), new Object[]{"https://tieba.baidu.com/mo/q/newmoindex"});
                    Boolean bool = Boolean.TRUE;
                    j.ab(bk, "setNeedBdussForGet", new Object[]{bool});
                    j.ab(bk, "setNeedSig", new Object[]{bool});
                    Object aa3 = j.aa(bk, "getNetString");
                    if (aa3 != null) {
                        String str = (String) aa3;
                        if (!TextUtils.isEmpty(str) && (jsonTbSign = (JsonTbSign) new Gson().fromJson(str, JsonTbSign.class)) != null && jsonTbSign.getNo() == 0 && jsonTbSign.getData() != null && jsonTbSign.getData().getLike_forum() != null) {
                            for (JsonTbSign.DataBean.LikeForumBean likeForumBean : jsonTbSign.getData().getLike_forum()) {
                                i e = b.e(i, String.valueOf(likeForumBean.getForum_id()));
                                try {
                                    if (e != null) {
                                        String str2 = e.c;
                                        try {
                                            long currentTimeMillis = System.currentTimeMillis();
                                            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                                            Date date = h.a;
                                            if (str2.equals(h.g(new Date(currentTimeMillis), simpleDateFormat))) {
                                                Object[] objArr2 = new Object[1];
                                                z = false;
                                                try {
                                                    objArr2[0] = "已经签到过了[" + likeForumBean.getForum_name() + "]";
                                                    j.bi(objArr2);
                                                    z2 = false;
                                                    i = 1;
                                                } catch (Throwable th) {
                                                    th = th;
                                                    atomicBoolean.set(z);
                                                    throw th;
                                                }
                                            }
                                        } catch (Throwable th2) {
                                            th = th2;
                                            z = false;
                                        }
                                    }
                                    objArr[0] = "https://tiebac.baidu.com/c/c/forum/sign";
                                    Object bk2 = j.bk(ak, objArr);
                                    Object[] objArr3 = new Object[2];
                                    objArr3[0] = "kw";
                                    objArr3[1] = likeForumBean.getForum_name();
                                    j.ab(bk2, "addPostData", objArr3);
                                    Object[] objArr4 = new Object[2];
                                    objArr4[0] = "fid";
                                    objArr4[1] = String.valueOf(likeForumBean.getForum_id());
                                    j.ab(bk2, "addPostData", objArr4);
                                    XposedHelpers.setBooleanField(j.aa(j.aa(bk2, "getNetContext"), "getRequest"), "mIsNeedTbs", true);
                                    Object[] objArr5 = new Object[1];
                                    objArr5[0] = Boolean.TRUE;
                                    j.ab(bk2, "setNeedSig", objArr5);
                                    String str3 = (String) j.aa(bk2, "postNetData");
                                    if (!TextUtils.isEmpty(str3) && (tBInSignJson = (TBInSignJson) new Gson().fromJson(str3, TBInSignJson.class)) != null) {
                                        if ("0".equals(tBInSignJson.getError_code())) {
                                            if (!j.ae("AutoSignTip")) {
                                                f i4 = f.i();
                                                i4.n();
                                                i4.l("签到成功[" + likeForumBean.getForum_name() + "]");
                                            }
                                            String valueOf = String.valueOf(likeForumBean.getForum_id());
                                            long currentTimeMillis2 = System.currentTimeMillis();
                                            SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
                                            Date date2 = h.a;
                                            b.k(valueOf, 1, h.g(new Date(currentTimeMillis2), simpleDateFormat2), "");
                                        } else {
                                            Object[] objArr6 = new Object[1];
                                            objArr6[0] = "签到失败[" + likeForumBean.getForum_name() + "]->" + tBInSignJson.getError_msg();
                                            j.bi(objArr6);
                                            if (tBInSignJson.getError_msg().contains("之前已经签过了")) {
                                                String valueOf2 = String.valueOf(likeForumBean.getForum_id());
                                                long currentTimeMillis3 = System.currentTimeMillis();
                                                SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy-MM-dd");
                                                Date date3 = h.a;
                                                b.k(valueOf2, 1, h.g(new Date(currentTimeMillis3), simpleDateFormat3), "");
                                            }
                                            f i5 = f.i();
                                            i5.j();
                                            i5.l("签到失败[" + likeForumBean.getForum_name() + "]->" + tBInSignJson.getError_msg());
                                        }
                                    }
                                    z2 = false;
                                    i = 1;
                                } catch (Throwable th3) {
                                    th = th3;
                                    z = false;
                                    atomicBoolean.set(z);
                                    throw th;
                                }
                                ak = j.ak("com.baidu.tbadk.core.util.NetWork");
                                objArr = new Object[1];
                            }
                        } else {
                            z2 = false;
                        }
                    }
                    atomicBoolean.set(z2);
                    return;
                } catch (Throwable th4) {
                    th = th4;
                    z = z2;
                }
                break;
            case 8:
                int i6 = d.a.a;
                f.i().l("未找到音乐文件");
                return;
            case 9:
                int i7 = d.a.a;
                f i8 = f.i();
                i8.n();
                i8.l("已替换无水印下载地址");
                return;
            case 10:
                int i9 = d.a.a;
                androidx.activity.b.u("未找到无水印下载地址");
                return;
            case 11:
                int i10 = f.d.a;
                j.aa(gf.f.cp, "notifyDataSetChanged");
                return;
            case 12:
                int i11 = i.b.a;
                Cursor cursor = (Cursor) j.ab(y.by.getEnMicroMsg(), "rawQuery", new Object[]{"select * from rcontact", null});
                if (cursor != null) {
                    int columnIndex = cursor.getColumnIndex("username");
                    while (cursor.moveToNext()) {
                        ab.cy(cursor.getString(columnIndex));
                    }
                }
                cursor.close();
                ab.cx();
                r.f i12 = r.f.i();
                i12.n();
                i12.l("已清除未读");
                return;
            default:
                e.b((e.b) null, true);
                return;
        }
    }
}
